Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Loading and starting controllers through service calls
Description: How to start controllers in ros_controlTutorial Level: BEGINNER
Contents
Controllers are loaded into the the controller_manager through service requests. These service requests can be sent manually at the command line, or through the controller spawner python script that can be used inside of roslaunch files.
Command Line Service Calls
Load the controllers:
rosservice call /rrbot/controller_manager/load_controller "name: 'joint1_position_controller'" rosservice call /rrbot/controller_manager/load_controller "name: 'joint2_position_controller'"
Start the controllers:
rosservice call /rrbot/controller_manager/switch_controller "{start_controllers: ['joint1_position_controller','joint2_position_controller'], stop_controllers: [], strictness: 2}"
Stop the controllers:
rosservice call /rrbot/controller_manager/switch_controller "{start_controllers: [], stop_controllers: ['joint1_position_controller','joint2_position_controller'], strictness: 2}"
ROSLaunch Call
The following uses a mode controller to tell the hardware interface which control mode to use (velocity in this instance). It also loads a controller for each arm of the robot in this example. This spawner loads and starts all three controllers.
<!-- Load the default controllers --> <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen" ns="/robot" args="velocity_joint_mode_controller right_velocity_trajectory_controller left_velocity_trajectory_controller " />